placesview: Make "Other Locations" search case-insensitive
authorTimm Bäder <mail@baedert.org>
Sun, 21 Jul 2019 07:51:54 +0000 (09:51 +0200)
committerTimm Bäder <mail@baedert.org>
Sun, 21 Jul 2019 07:51:54 +0000 (09:51 +0200)
It's just weird to search for "c" and not find the list item labelled
"Computer".

gtk/gtkplacesview.c

index 75c4af23722938a8d06ad80fc2d241f8c8b04604..f91c7e2d8c27adc4d77629749275739ed26049bf 100644 (file)
@@ -1999,10 +1999,22 @@ listbox_filter_func (GtkListBoxRow *row,
                 NULL);
 
   if (name)
-    retval |= strstr (name, priv->search_query) != NULL;
+    {
+      char *lowercase_name = g_utf8_strdown (name, -1);
+
+      retval |= strstr (lowercase_name, priv->search_query) != NULL;
+
+      g_free (lowercase_name);
+    }
 
   if (path)
-    retval |= strstr (path, priv->search_query) != NULL;
+    {
+      char *lowercase_path = g_utf8_strdown (path, -1);
+
+      retval |= strstr (lowercase_path, priv->search_query) != NULL;
+
+      g_free (lowercase_path);
+    }
 
   g_free (name);
   g_free (path);
@@ -2459,7 +2471,7 @@ gtk_places_view_set_search_query (GtkPlacesView *view,
   if (g_strcmp0 (priv->search_query, query_text) != 0)
     {
       g_clear_pointer (&priv->search_query, g_free);
-      priv->search_query = g_strdup (query_text);
+      priv->search_query = g_utf8_strdown (query_text, -1);
 
       gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->listbox));
       gtk_list_box_invalidate_headers (GTK_LIST_BOX (priv->listbox));